package com.runvp.service.biz.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.runvp.common.annotation.Excel;
import com.runvp.common.core.domain.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.persistence.Transient;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 系统配置对象 biz_index_tj
 *
 * @author runvp
 * @date 2022-11-19
 */
@ToString
@Getter
@Setter
public class BizIndexTj extends BaseEntity {

    private static final long serialVersionUID = 308006984365957516L;
    /** 主键ID */
    private Long id;
    @Transient
    private String st;
    @Transient
    private String et;
    /** 订单类型 */
    @Transient
    private String type;

    /** 设备类型 */
    @Transient
    private String deviceType;
    @Transient
    private Long tenantId;
    /** 设备名称 */
    @Excel(name = "设备名称")
    private String name;
    /** 设备号 */
    @Excel(name = "设备编号")
    private String deviceCode;

    /** 订单总额 */
    @Excel(name = "订单总额")
    private BigDecimal amount;

    /** 订单数 */
    @Excel(name = "订单数")
    private Long count;


    /** 天数 */
    @Transient
    private int days;

    /**
     * 日期
     */
    @Transient
    private String day;

    /** 统计时间 */
    @Transient
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date tjTime;

    public String getSt() {
        if(st == null || st == ""){
            return st;
        }
        return st+ " 00:00:00";
    }

    public String getEt() {
        if(et == null || et == ""){
            return et;
        }
        return et+" 23:59:59";
    }
}
